package com.ckx.blog.controller;

import com.ckx.domain.ResponseResult;
import com.ckx.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;

@RestController
public class OssController {

    @Autowired
    private UploadService uploadService;

    @PostMapping("/upload")
    public ResponseResult uploadImg(MultipartFile img) throws IOException {
        String url = uploadService.uploadImg(img);
        return ResponseResult.okResult(url);
    }

}
